const util = require('../../../../common/util/util.js')

Page({
    data: {
        xPageReady : true ,
        xList : ''
    },

    onLoad: function (options) {
        this.xInit(options.id)
    },

    xInit: async function (id) {
        let that = this

        await wx.cloud.callFunction({
            name: 'digital_therapy',
            data: {
                action: "get_interview_list_by_user",
                user_openid: id
            }
        }).then(res => {
            console.log("返回数据:", res)
            let list = res.result
            for(var i in list){
                list[i].pay_time = util.formatDate_chinese(new Date(list[i].pay_time))
                if(list[i].summary.length > 0){
                    for(var k in list[i].summary){
                        list[i].summary[0].create_time = util.formatDate_chinese(new Date(list[i].summary[0].create_time ))
                    }
                }
            }
           
            that.setData({
                xList : list
            })
        })

        that.setData({
            xPageReady : false
        })
    },
})